package com.dreamchaser.familydevice.constant;

import com.dreamchaser.familydevice.domain.dto.DeviceExpression;

import java.util.HashSet;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/***
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *                 .' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >' "".
 *       | | : `- \`.;`\ _ /`;.`/ -` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * =============================================
 *          佛祖保佑             永无BUG
 *
 *
 * @Author: SJie
 * Date: 2020/8/17 13:37
 * Description: 设备缓存
 *
 */

public class DeviceCache {

    /**
     * 所有组件状态变量
     */
    public static volatile HashSet<String> ComStatusVar;
    /**
     * 组件表达式
     */
    public static volatile List<DeviceExpression> ComExperssion;

    /**
     * 任务id
     */
    public static ConcurrentHashMap<String,Integer> taskName=new ConcurrentHashMap();


    public static void removeVarByVar(String var) {
        if (ComStatusVar != null) {
            for (String s : ComStatusVar) {
                if (s.startsWith(var)) {
                    ComStatusVar.remove(s);
                    return;
                }
            }
        }
    }
}
